//
// Created on 2024/8/9.
//
// Node APIs are not fully supported. To solve the compilation error of the interface cannot be found,
// please include "napi/native_api.h".

#ifndef SOCKETIO_TSFUNC_CONTEXT_H
#define SOCKETIO_TSFUNC_CONTEXT_H

#include "napi/native_api.h"
#include <string>

namespace OHOS {
namespace SocketIO {


class SocketIOContext {
public:

    SocketIOContext() = delete;
    
//     ~SocketIOContext();
    
    SocketIOContext(napi_env env);
    
    void ReleaseTsFunction();

    void CallTsFunction(void *data);

    void CreateTsFunction(napi_value func, const std::string &resourceName, void *context,
                          napi_threadsafe_function_call_js callJsCallback);
    
private:
    napi_env env_;
    
    napi_threadsafe_function tsFunc_;
    
};
};
} // namespace OHOS::SocketIO

#endif //SOCKETIO_TSFUNC_CONTEXT_H